package com.prd.controller;

import com.prd.enums.SendCodeEnum;
import com.prd.service.NotifyService;
import com.prd.util.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * @Author lizhaoyi
 * @date 2023/10/23 16:23
 * Description:
 */

@Api(tags = "通知模块")
@RestController
@RequestMapping("/api/user/v1")
@Slf4j
public class NotifyController {

    @Autowired
    private NotifyService notifyService;


    @ApiOperation("发送手机号验证码")
    @PostMapping("sendCode")
    public JsonData sendCode(@RequestParam(value = "to") String to){

        return notifyService.sendCode(SendCodeEnum.USER_REGISTER,to);

    }

    @ApiOperation("实名认证")
    @PostMapping("authenticate")
    public JsonData authenticate(@ApiParam("姓名") @RequestParam(value = "name") String name,
                                 @ApiParam("身份证号码") @RequestParam(value = "idCardNum") String idCardNum,
                                 @ApiParam("身份证图片正面照") @RequestParam(value = "idCardFaceImg") String idCardFaceImg,
                                 @ApiParam("身份证图片反面照") @RequestParam(value = "idCardBackImg") String idCardBackImg){

        return notifyService.authenticate(name,idCardNum,idCardFaceImg,idCardBackImg);
    }
}



